import React, { Component } from 'react'
import Test from './test'

export default class ShowMount extends Component {
  constructor(props) {
    super(props)
    this.state = {mount: props.startMount}
    this.handleClick = this.handleClick.bind(this)
  }
  handleClick() {
    this.setState((state) => {
      return {mount: state.mount + 1}
    })
    this.props.callback(this.state.mount + 1)
  }
  componentDidMount() {
  }
  render() {
    return (
      <div>
        <Test mount={this.state.mount}/>
        {this.props.name}<button onClick={this.handleClick}>click</button>次数：{this.state.mount}
      </div>
    )
  }
}
